#pragma once
#include <pthread.h>
class LockGuard
{
private:
    pthread_mutex_t *_mtx;

public:
    LockGuard(pthread_mutex_t *mtx)
        : _mtx(mtx)
    {
        pthread_mutex_lock(_mtx);
    }
    ~LockGuard()
    {
        pthread_mutex_unlock(_mtx);
    }
};